package carclockpack;

import java.util.Calendar;

public class MinuteSetupState implements ClockSetupState {
    private ClockSetup clockSetup;
    private int minute;
 
    public MinuteSetupState(ClockSetup clockSetup) {
        this.clockSetup = clockSetup;
        minute = Calendar.getInstance().get(Calendar.MINUTE);
    }
 
    public void previousValue() {
        if (minute > 0) {
            minute--;
        }
    }
 
    public void nextValue() {
        if (minute < 59) {
            minute++;
        }
    }
 
    public void selectValue() {
        System.out.println("Minute set to " + minute);
        clockSetup.setState(clockSetup.getFinishedSetupState());
    }
 
    public String getInstructions() {
        return "Please set the minute...";
    }
 
    public int getSelectedValue() {
        return minute;
    }
}